-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Append AZURE_HTTP_USER_AGENT environment variable to UserAgent string. #483
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jeffreyCline
Thanks for this PR :)
I've taken a look and it mostly LGTM (I've left a couple of minor comments around our conventions going forward - but they're not blockers by any means). Out of interest, where's this environment variable going to be set?
Thanks!
azurerm/config.go
Outdated
@@ -189,7 +191,15 @@ func withRequestLogging() autorest.SendDecorator { | |||
|
|||
func setUserAgent(client *autorest.Client) { | |||
version := terraform.VersionString() | |||
azureAgent := os.Getenv("AZURE_HTTP_USER_AGENT") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of interest - what's the use-case for this / where's this going to be set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The azure compute cloud shell sets this in their dockerfile (i.e. ENV AZURE_HTTP_USER_AGENT cloud-shell/1.0). This way we can collect some BI data on the provider/environment usage.
azurerm/config.go
Outdated
|
||
if azureAgent != "" { | ||
s := []string{client.UserAgent, azureAgent} | ||
client.UserAgent = strings.Join(s, ";") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor we'd tend to just format this directly:
client.UserAgent = fmt.Sprintf("%s;%s", client.UserAgent, azureAgent)
azurerm/config.go
Outdated
client.UserAgent = fmt.Sprintf("HashiCorp-Terraform-v%s", version) | ||
|
||
if azureAgent != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor we'd tend to make this:
if azureAgent := os.Getenv("AZURE_HTTP_USER_AGENT"); azureAgent != "" {
// set it
}
rather than separating it out :)
azurerm/config.go
Outdated
@@ -190,6 +191,12 @@ func withRequestLogging() autorest.SendDecorator { | |||
func setUserAgent(client *autorest.Client) { | |||
version := terraform.VersionString() | |||
client.UserAgent = fmt.Sprintf("HashiCorp-Terraform-v%s", version) | |||
|
|||
if azureAgent := os.Getenv("AZURE_HTTP_USER_AGENT"); azureAgent != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to add a comment here to explain it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed a commit to add this.
@tombuildsstuff after it's merged, when it will be released to public ? We want to let the BI team start the monitoring after the release. |
@metacpp I'm not sure exactly when - but we'll do a release at some point early next week :) |
@tombuildsstuff thanks for the quick merge. @jeffreyCline will follow up on the release of plugin. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
No description provided.